package cn.demoncat.util.fastdfs.constant;

/**
 * FastDFS常量
 * 
 * @author 延晓磊
 *
 * @since 2019年11月4日
 */
public class FdConstant {

	/**
	 * 分块上传的缓存大小（必须小于分块最小限制）
	 */
	public static final int APPEND_BUFF_SIZE = 1024*1024*2;
	/**
	 * 分块上传的最小文件限制
	 */
	public static final int APPEND_LIMIT_MIN = 1024*1024*20;
	
	/**
	 * 客户端操作命令
	 * 
	 * @author 延晓磊
	 *
	 * @since 2019年11月4日
	 */
	public enum StorageCmd{
		STORAGE_PROTO_CMD_UPLOAD_FILE(11, "上传文件"),
		STORAGE_PROTO_CMD_UPLOAD_SLAVE_FILE(21, "上传副本"),
		STORAGE_PROTO_CMD_UPLOAD_APPENDER_FILE(23, "上传续传文件"),
		STORAGE_PROTO_CMD_DELETE_FILE(12, "删除文件"),
		STORAGE_PROTO_CMD_APPEND_FILE(24, "续传文件"),
		STORAGE_PROTO_CMD_TRUNCATE_FILE(36, "截断文件"),
		STORAGE_PROTO_CMD_DOWNLOAD_FILE(14, "下载文件")
		;
		
		private final byte cmd;
		private final String remarks;
		
		StorageCmd(int cmd, String remarks) {
			this.cmd = (byte)cmd;
			this.remarks = remarks;
		}
 
		public byte getCmd() {
			return cmd;
		}
		public String getRemarks() {
			return remarks;
		}
	}
}
